package test08.ts01;

import java.util.Optional;
import java.util.stream.Stream;

/**
 * @Author czl
 * @Date 2024-04-15
 */
public class MainTest02 {
    public static void main(String[] args) {
        Integer [] arr = {1,2,7,4,3,6,5};

        Stream<Integer> stream = Stream.of(arr);

        Optional<Integer> reduce = stream.reduce(Integer::sum);

        System.out.println(reduce.orElse(0));
    }
}
